package first;


public class Student extends Observable {

	private int id;
	private String name;
	
	public Student(int id) {
		this.id = id;
	}
	
	public void name(String name) {
		this.name = name;
		notifyObservers();
	}
	
	public void printName() {
		System.out.println(name);
	}
	
	public int add(int y) {
		return id + y;
	}

	@Override
	public void notifyObservers() {
		for (Observer obs: observers) {
			obs.update(name);
			obs.update2(null);
		}
	}
	
}
